package com.gitee.cui.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * TODO
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022-03-12 19:25
 **/
@Configuration
public class GatewayConfig {

	@Bean
	public RouteLocator baiduGuoNei(RouteLocatorBuilder builder) {
		RouteLocatorBuilder.Builder routes = builder.routes();
		routes.route("route_baidu_guonei", r -> r.path("/guonei").uri("http://news.baidu.com/guonei")).build();
		return routes.build();
	}

	@Bean
	public RouteLocator baiduGuoJi(RouteLocatorBuilder builder) {
		RouteLocatorBuilder.Builder routes = builder.routes();
		routes.route("route_baidu_guoji", r -> r.path("/guoji").uri("http://news.baidu.com/guoji")).build();
		return routes.build();
	}
}
